package com.example.client_fmf;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

public class RecieverThread implements Runnable{
	
	
	private InputStream socketInputStream ;
	private OutputStream socketOutputStream ;
	public AsyncResponse delegate = null;
	

	
	public RecieverThread(Socket socket,
			AsyncResponse delegate1) throws IOException {
		socketInputStream = socket.getInputStream() ;  
		socketOutputStream = socket.getOutputStream() ;
		delegate =  delegate1 ;
	}
	
	@Override
	public void run() {
		
		 while(true)
		   {
			   byte[] data = new byte[100] ; 
			   
             	try 
             	{
					socketInputStream.read(data) ;	
				
					String s  = new String(data, "UTF-8") ; 
					delegate.processFinish( new String(data, "UTF-8"));
				} 
             	catch (IOException e) 
             	{
					e.printStackTrace();
				} 
			   
		   }
		
	}
	

}
